﻿Imports Entidad
Imports System.Data
Imports System.Data.SqlClient
Public Class VehiculoDatos

    Function listarVehiculos() As DataSet
        Dim conex As New Conexion
        Dim coneccion As SqlConnection = conex.conectar()
        coneccion.Open()
        Dim query As String = "SELECT v.VEH_Codigo,v.VEH_Placa, ma.MAR_Descripcion+'/'+m.MOD_Descripcion AS Descripcion, " &
                              "v.VEH_PesoNeto, v.VEH_Volumen " &
                              "FROM Vehiculo v " &
                              "INNER JOIN Modelo m " &
                              "ON m.MOD_Codigo = v.MOD_Codigo AND m.MOD_Activo = '1' " &
                              "INNER JOIN Marca ma " &
                              "ON ma.MAR_Codigo = m.MAR_Codigo AND ma.MAR_Activo = '1' " &
                              "WHERE v.VEH_Activo = '1'"

        Dim adapter As New SqlDataAdapter(query, coneccion)
        Dim ds As New DataSet
        adapter.Fill(ds)

        coneccion.Close()

        Return ds
    End Function

End Class
